#pragma once

#include <BWAPI.h>
#include <string>
#include <ctime>
#include <time.h>
#include "hugin"
#include "policyFileParser.h"
#include <sstream>
#include <fstream>

using namespace BWAPI;
using namespace std;
using namespace stdext;

class ControlBot
{
private:
	Unit * _agent;
	int _currentStep;
	float _timeSinceLastStep;
	float _timeBetweenSteps;
	clock_t _lastTime;
	PolicyFileParser *_decisionTreeParser;
	int _maxSteps;
	float _escapeDistance;
	Position _lastKnownEnemyPosition;

	string _outputCsvFIle;
	string _lastObservation;
	string _lastAction;

	list<string> _csvRows;

public:
	ControlBot(PolicyFileParser * parser,  int maxSteps, int timeStepDuration, string outputCsvFile);

	void Attack();
	void Escape();
	void Nothing();
	void MakeDecision();
	void Tick();
	bool CanSeeEnemy();
	Unit * GetNearestEnemy();

	void SaveCsvTimeStep();
};

